//package com.example.springai.langchat;
//
//import dev.langchain4j.data.embedding.Embedding;
//import dev.langchain4j.data.segment.TextSegment;
//
//import dev.langchain4j.model.embedding.EmbeddingModel;
//import dev.langchain4j.model.openai.OpenAiEmbeddingModel;
//import dev.langchain4j.store.embedding.EmbeddingMatch;
//import dev.langchain4j.store.embedding.EmbeddingStore;
//import dev.langchain4j.store.embedding.neo4j.Neo4jEmbeddingStore;
//
//
//import java.util.List;
//
//public class Neo4jEmbeddingStoreExample {
//
//    public static void main(String[] args) {
//
//            EmbeddingStore<TextSegment> embeddingStore = Neo4jEmbeddingStore.builder()
//                    .indexName("guoke_index")
//                    .withBasicAuth("neo4j://localhost:7687", "neo4j", "password")
//                    .dimension(1024)
//                    .build();
//
//            EmbeddingModel embeddingModel = OpenAiEmbeddingModel.builder()
//                    .baseUrl("https://api.siliconflow.cn/v1").dimensions(384)
//
////                .proxy(new Proxy(Proxy.Type.HTTP,new InetSocketAddress("127.0.0.1", 7890)))
//                    .apiKey("sk-nrvjihoykgbjabnelziszukgkcankraqcwtvohvpcuepuyyz").modelName("Pro/BAAI/bge-m3").logRequests(true).logResponses(true).dimensions(1024)
//                    .build();
//
//            TextSegment segment1 = TextSegment.from("I like football.");
//            Embedding embedding1 = embeddingModel.embed(segment1).content();
//            embeddingStore.add(embedding1, segment1);
//
//            TextSegment segment2 = TextSegment.from("The weather is good today.");
//            Embedding embedding2 = embeddingModel.embed(segment2).content();
//            embeddingStore.add(embedding2, segment2);
//
//            Embedding queryEmbedding = embeddingModel.embed("What is your favourite sport?").content();
//
//            List<EmbeddingMatch<TextSegment>> relevant = embeddingStore.findRelevant(queryEmbedding, 1);
//            EmbeddingMatch<TextSegment> embeddingMatch = relevant.get(0);
//
//            System.out.println(embeddingMatch.score()); // 0.8144289255142212
//            System.out.println(embeddingMatch.embedded().text()); // I like football.
//
//    }
//}